function out=f_get_BB_model(h_l,h_r,ifplot,L_or_R)
fs = 32.1e3; % this is the one for the 3D3A database
dur = 10;
soundwave=randn(round(fs*dur),1); % BB
x1=conv(h_l,soundwave);
x2=conv(h_r,soundwave);
nfft = round(40e-3*fs);
% nfft = round(160e-3*fs);
win = hamming(nfft,'periodic');
freqs = (1:(nfft/2))./(nfft/2).*fs/2;
% [SL,SR,freq_pos, flag01]=mySTFT(x1,x2,fs);
SL = stft(x1,fs,'Window',win,'FFTLength',nfft);
SR = stft(x2,fs,'Window',win,'FFTLength',nfft);
SL = SL(end/2+1:end,:);
SR = SR(end/2+1:end,:);
% sdf9
% [SL1,SR1]=Normalize(SL,SR);
[SL1,SR1]=Normalize_Both(SL,SR,L_or_R);
% % % %      short time fourier transform:
for ifreql = 1:length(freqs)/2
    freq = freqs(ifreql);
    %      normalization:
    % X_P = [real(SR1(Ind,flag01>0))' imag(SR1(Ind,flag01>0))'];
    if L_or_R ==2 % old
        X_P = [real(SR1(ifreql,:))' imag(SR1(ifreql,:))'];
    else
        X_P = [real(SL1(ifreql,:))' imag(SL1(ifreql,:))'];
    end
    [IDX, C] = kmeans(X_P, 1,'Distance','cityblock','Replicates',5);
    F_centers(ifreql,:) = C;
    if ifplot==1 & ifreql< 13
        figure(f1)
        subplot(3,4,ifreql)
        plot(X_P(:,1),X_P(:,2),'.','Markersize',4);
        set(gca,'Xtick',-1:0.5:1)
        set(gca,'Ytick',-1:0.5:1)
        title([ num2str(freq), ' Hz'],'fontsize',8);
        hold on;
        plot(-1:1,[0,0,0],'k', 'LineWidth', 0.5);
        plot([0,0,0],-1:1,'k','LineWidth',0.5)
        axis([-1.1 1.1 -1.1 1.1])
        axis square
        box off
        s=plot(C(1),C(2),'o');set(s,'markersize',18)
        pause(0.01)
    end
end
out.F_centers=F_centers;
